/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.recharge.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.boxin.ims.modules.wechat.entity.WechatMember;
import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 推荐奖励储值Entity
 * @author XiaoQian
 * @version 2014-04-09
 */
@Entity
@Table(name = "wp_recharge_cache")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class RechargeCache extends BaseEntity {
	
	public final static String NOT_ACTIVATE = "0";
	public final static String ACTIVATE = "1";
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private String name; 	// 名称
	private String type;	//储值奖励的类型		0:储值 
	private WechatMember parentMember;	//所属父类会员
	private WechatMember childMember;	//所属子类会员
	private Integer money;			//值
	private Integer score;			//增加积分
	private String status;				//状态   0未激活      1激活
	private Date createTime;	// 创建日期
	private Date updateTime;	//更新时间
	private String remarks;				//备注

	public RechargeCache() {
		this.createTime = new Date();
	}

	public RechargeCache(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_recharge_rechargeCache")
	//@SequenceGenerator(name = "seq_recharge_rechargeCache", sequenceName = "seq_recharge_rechargeCache")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
	
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	
	@ManyToOne
	@JoinColumn(name="parent_member_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public WechatMember getParentMember() {
		return parentMember;
	}

	public void setParentMember(WechatMember parentMember) {
		this.parentMember = parentMember;
	}
	
	@ManyToOne
	@JoinColumn(name="child_member_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public WechatMember getChildMember() {
		return childMember;
	}

	public void setChildMember(WechatMember childMember) {
		this.childMember = childMember;
	}

	public Integer getMoney() {
		money = money == null ?0 : money;
		return money;
	}

	public void setMoney(Integer money) {
		this.money = money;
	}

	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	} 

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Integer getScore() {
		score = score == null ? 0:score;
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}
	
	
	
	
}


